<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='global-property-'>/**
</span> * @ignore
 * scrollbar plugin for KISSY scroll-view
 * @author yiminghe@gmail.com
 */
KISSY.add('scroll-view/plugin/scrollbar', function (S, Base, ScrollBar) {
<span id='KISSY-ScrollView-Plugin-ScrollBar'>    /**
</span>     * ScrollBar plugin for ScrollView.
     * @class KISSY.ScrollView.Plugin.ScrollBar
     * @extend KISSY.Base
     */
    return Base.extend({
        pluginId: this.getName(),

        pluginSyncUI: function (scrollView) {
            var self = this;
            var minLength = self.get('minLength');
            var autoHideX = self.get('autoHideX');
            var autoHideY = self.get('autoHideY');
            var my;
            var cfg = {
                scrollView: scrollView,
                // render: scrollView.get('el') =&gt; ie7 bug
                elBefore: scrollView.$contentEl
            };
            if (minLength !== undefined) {
                cfg.minLength = minLength;
            }

            if (self.scrollBarX) {
                self.scrollBarX.sync();
            } else if (scrollView.allowScroll['left']) {
                my = {
                    axis: 'x'
                };
                if (autoHideX !== undefined) {
                    cfg.autoHide = autoHideX;
                }
                self.scrollBarX = new ScrollBar(S.merge(cfg, my)).render();
            }

            if (self.scrollBarY) {
                self.scrollBarY.sync();
            } else if (scrollView.allowScroll['top']) {
                my = {
                    axis: 'y'
                };
                if (autoHideY !== undefined) {
                    cfg.autoHide = autoHideY;
                }
                self.scrollBarY = new ScrollBar(S.merge(cfg, my)).render();
            }
        },

        pluginDestructor: function () {
            var self = this;
            if (self.scrollBarX) {
                self.scrollBarX.destroy();
                self.scrollBarX = null;
            }
            if (self.scrollBarY) {
                self.scrollBarY.destroy();
                self.scrollBarY = null;
            }
        }
    }, {
        ATTRS: {
<span id='KISSY-ScrollView-Plugin-ScrollBar-cfg-minLength'>            /**
</span>             * minimum scrollbar length.
             * Defaults to 20.
             * @cfg {Number} minLength
             */
<span id='global-property-minLength'>            /**
</span>             * @ignore
             */
            minLength: {

            },
<span id='KISSY-ScrollView-Plugin-ScrollBar-cfg-autoHideX'>            /**
</span>             * whether auto hide x scrollbar like ios
             * @cfg {Boolean} autoHideX
             */
<span id='global-property-autoHideX'>            /**
</span>             * @ignore
             */
            autoHideX: {

            },
<span id='KISSY-ScrollView-Plugin-ScrollBar-cfg-autoHideY'>            /**
</span>             * whether auto hide y scrollbar like ios
             * @cfg {Boolean} autoHideY
             */
<span id='global-property-autoHideY'>            /**
</span>             * @ignore
             */
            autoHideY: {

            }
        }
    });
}, {
    requires: ['base', './scrollbar/control']
});</pre>
</body>
</html>
